package ilearn.job.disserver.sdk.account;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import ilearn.job.disserver.sdk.account.dto.AccountDTO;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.json.JacksonJsonParser;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
@Log4j2
public class RabbitMQReciver {

    @Autowired
    private AccountCache accountCache;

    public void receiveMessage(AccountDTO accountDTO) throws JsonProcessingException {
        log.info("收到消息Json:{}",accountDTO);
        accountCache.updateAccount(accountDTO);
        log.info("消息处理完成");
    }

    public void handleMessage(AccountDTO accountDTO){
        log.info("收到消息Json:{}",accountDTO);
        accountCache.updateAccount(accountDTO);
        log.info("消息处理完成");
    }

}
